import React from 'react'
import './App.css';
import 'antd/dist/antd.css'
import {Switch, Route, Redirect} from 'react-router-dom'

import {adminRoute} from "./routes";
import Frame from './components/Frame/Index'

function App() {
    return (
           <Frame>
            <Switch>
                {adminRoute.map(route => {
                    return (
                        <Route key={route.path}
                               path={route.path}
                               exact={route.exact}
                               render={routeProps => {
                                   return <route.component {...routeProps}/>;
                               }}>
                        </Route>
                    )
                })}
                <Redirect to={adminRoute[0].path} from="/admin"></Redirect>
                <Redirect to="/404"></Redirect>
            </Switch>

           </Frame>
    );
}

export default App;
